var app = getApp();

Page({
    data: {
        status: 1,
        mygd:false
    },
    onLoad(options) {
        app.setNavigationBarColor(this);
        this.GetShuipiaoList();
    },
    ChangeList(t) {
        let t_status = t.currentTarget.dataset.status;
        if (t_status != this.data.status) {
            this.setData({
                status: t_status,
                waterList: [],
                mygd:false
            });
            if (t_status == 1) {
                this.GetShuipiaoList();
            } else if (t_status == 2) {
                this.GetShuipiaoLogs();
            }
        }
    },
    GetShuipiaoList: function() {
        var o = this,
            u_id = wx.getStorageSync("users").id;
        app.util.request({
            url: "entry/wxapp/GetShuipiaoList",
            cachetime: "0",
            data: {
                user_id: u_id,
                page: 1,
                pagesize: 1000
            },
            success: function(n) {
                o.setData({
                    waterList: n.data
                });
                setTimeout(() => {
                    o.setData({
                        mygd: true
                    });
                }, 500)
            }
        });
    },
    GetShuipiaoLogs: function() {
        var o = this,
            u_id = wx.getStorageSync("users").id;
        app.util.request({
            url: "entry/wxapp/GetShuipiaoLogs",
            cachetime: "0",
            data: {
                user_id: u_id,
                page: 1,
                pagesize: 1000
            },
            success: function(n) {
                o.setData({
                    waterList: n.data
                });
                setTimeout(() => {
                    o.setData({
                        mygd: true
                    });
                }, 500)
            }
        });
    },
})